﻿using System;
using System.Data;
using System.Collections;
using System.Text.RegularExpressions;
using System.Text;
using System.Web.Caching;

using LTJ.Common;
using LTJ.Data;
using LTJ.Config;
using LTJ.Entity;
using LTJ.Common.Generic;
using LTJ.Cache;

namespace LTJ.FrameWork
{
    /// <summary>
    /// 静态统计
    /// </summary>
    public class Static
    {
        /// <summary>
        /// 根据企业ID获取企业统计信息
        /// </summary>
        public static StaticInfo GetStaticInfoByCid(int cid)
        {
            LTJ.Cache.SASCache cache = LTJ.Cache.SASCache.GetCacheService();
            string cachekey = "/LTJ/StaticCorp_" + cid;
            StaticInfo sinfo = cache.RetrieveObject(cachekey) as StaticInfo;
            if (sinfo == null)
            {
                sinfo = Data.DataProvider.Statics.GetStaticInfoByCid(cid);
                LTJ.Cache.ICacheStrategy ica = new DYJCacheStrategy();
                ica.TimeOut = 30;
                cache.LoadCacheStrategy(ica);
                cache.AddObject(cachekey, sinfo);
                cache.LoadDefaultCacheStrategy();
            }
            return sinfo;
        }
    }
}
